1. Field
The invention relates to a computing environment. More particularly to a computer program, method, and system for achieving fine-grained performance configuration of an application.
2. General Background
Object-oriented programming (OOP) is a programming paradigm using “objects” including the data and their methods to design applications and computer programs. An individual routine may form a subprogram that can encapsulate data and perform a function isolated from other subprograms. The separation between different objects improves reusability, flexibility, and extension of software. For the purpose of achieving a complete function, each object can receive information, process data and send information to other objects.
In object-oriented programming, a class is usually used to encapsulate a specific function or provide a blueprint that may be used for creating an object. It describes features and methods common to the created objects. All data and code contained in an object can be constructed by an instance of a class.
A stricter definition of a class is a cohesive packet composed of some type of specific metadata. It describes rules of behaviors of some objects, and these objects are referred to as instance of the class. A class has an interface and a structure. The interface describes how to interact with the class and its instance by a method, while the structure describes how to divide data in each instance into multiple features. A class is a specific type of object in a certain layer. A class has a representative form (meta object) at runtime, and it provides support at runtime for operating metadata relevant to the class.
There are some performance-sensitive classes, such as, collection utility classes which may have different configurations which produce different performance behaviors at runtime. Some configurations can make classes run faster but consume more memory; while some configurations can make classes consume less memory but run slower. Part of these configurations might be exposed through an Application Programming Interface (API) of a class, while other configurations may be hidden.
ArrayList in Java™ has a constructor ArrayList (initialCapacity) which allows the developer to explicitly specify the initial size of its internal data structure. (Java and all Java-based trademarks and logos are trademarks or registered trademarks of Oracle and/or its affiliates.) However, there are other hidden configurations that may affect ArrayList's performance behavior, such as the size-growth strategy and accompanying parameters, i.e., it can grow at a constant pace, with 10 in conservative cases and 100 in aggressive cases; it can also grow in a multiplying way, with 1.1 times in conservative cases and 2 times in aggressive cases. However, all these are invisible to developers.
Depending on different scenarios applied in an application, there may be different requirement for performance of the application code. For example, when a developer knows a HashMap instance will be used in a hot registry, he wants it to run faster even though that might makes it consume more memory. In the event that classA is a Daemon class used periodically, the programmer would want it to consume minimum memory even though that might makes it run slower. In other scenarios, the priority might be for the application to start up quickly.
However, currently there is no simple and unified approach to perform fine-grained performance configuration of an application to meet the requirements of the above scenarios.